<template>
	<div class="list-item">
		<div class="item" v-for="item in list" :key="item.id" @click="toDetailView(item)">
			<div class="flex">
				<div class="flex-left">
					<div class="title">{{item.name}}</div>
					<div class="desc margT-l">
						<span>{{$utils.parseToDateYMDHM(item.createtime)}}</span>
						<span class="margL-l">{{item.read}}次阅读</span>
					</div>
				</div>
				<div class="flex-right" v-if="item.picture">
					<van-image width="90" height="70" fit="cover" :src="item.picture" />
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default{
		props:{
			list:Array
		},
		mounted() {
			console.log("list",this.list)
		},
		methods:{
			toDetailView(item) {
				this.$store.commit('setZixunItem',item)
				this.$router.push({
					path:"/home/zixundetail",
					query:{
						id: item.id
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/assets/css/variable';
	.item {
		// margin-top: 0.4rem;
		// margin-left: 1rem;
		// margin-right: 1rem;
		padding: 0.8rem 1.6rem 1.2rem 1.6rem;
		background-color: white;
		border-bottom: 1px solid #f7f7f7;
		.flex {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			.flex-right {
				flex: 0 0 90px;
				height: 70px;
				border-radius: 0.6rem;
				overflow: hidden;
				position: relative;
				margin-left: 0.8rem;
			}
		
			.flex-left {
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
		
				.title {
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					/* 设置行数 */
					-webkit-box-orient: vertical;
					color: $color1;
					font-size: 1.6rem;
					line-height: 1.3em;
					overflow: hidden;
				}
		
				.desc {
					display: flex;
					justify-content: space-between;
					margin-bottom: 2px;
					span {
						color: #D8D7D7;
						&.split {
							font-size: 1rem;
						}
					}
				}
				.instudy{
					color:$color2;
				}
				.badgeBox {
					padding-bottom: 0.4rem;
					margin-top: 0.6rem;
					.badge {
						padding: 0.2rem 1rem;
						font-size: 1.2rem;
						background-color: #FFECDC;
						color: #FF6D00;
						border: 0.1rem solid #FF6D00;
						border-radius: 0.3rem;
						box-sizing: border-box;
						overflow: hidden;
					}
		
					.badge4status {
						padding: 0.2rem 1rem;
						font-size: 1.2rem;
						background-color: #E8E9E9;
						color: #999;
						border: 0.1rem solid #999;
						border-radius: 0.3rem;
						box-sizing: border-box;
						overflow: hidden;
					}
				}
			}
		}
	}
</style>
